import { db } from '../db/index'
import { Model, DataTypes } from 'sequelize'
import Admin from './Admin'
class UserInfo extends Model {
    public id!: number
    public role!: string
    public menu!: string
    public remake!: string
  }
  UserInfo.init({
    id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        autoIncrement: true,
        primaryKey: true
    },
    a_id: {
      type: DataTypes.INTEGER,
      comment: '所属',
      allowNull: false
    },
    name: {
        type: DataTypes.STRING,
        comment: '姓名',
        allowNull: false
    },
    age: {
        type: DataTypes.INTEGER,
        comment: '年龄',
        allowNull: false
    },
    remake: {
        type: DataTypes.STRING,
        comment: '备注',
        allowNull: false
    }
  }, {
    tableName: 'userinfo',
    modelName: 'userinfo',
    sequelize: db
  });
// 创建表
// UserInfo.belongsTo(Admin, {foreignKey: 'a_id'});
// UserInfo.sync({ force: true })
export default UserInfo